package cn.ad.server.persistence.dao;

import cn.ad.server.domain.ad.Ratio;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RatioDao {

	@Results(value = { @Result(column = "id", property = "id", id = true),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime") })
	@Select("select * from ratio")
	List<Ratio> findAll();

	@Results(value = { @Result(column = "id", property = "id", id = true),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime") })
	@Select("select * from ratio where update_time >= #{value}")
	List<Ratio> findAfterTime(String warmUpTime);
	
	@Results(value = { @Result(column = "id", property = "id", id = true),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime") })
	@Select("select * from ratio where id = #{value}")
	Ratio findById(long id);
	
	@Results(value = { @Result(column = "id", property = "id", id = true),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime") })
	@Select("select * from ratio where id = #{id} and status = #{status}")
	Ratio selectById(@Param("id")long id, @Param("status")int status );


}
